package com.itcheetah.springevent.observer;

import com.itcheetah.springevent.observer.impl.DragonKingObserver;
import com.itcheetah.springevent.observer.impl.MyGuardianObserver;
import com.itcheetah.springevent.observer.impl.ThunderGodObserver;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @className: ObserverTestController
 * @description: TODO
 * @author: cheetah
 * @date: 2021/11/30 11:27
 * @Version: 1.0
 */
@RestController
@RequestMapping("/observer")
public class ObserverTestController {

    @PostMapping
    public void observerTest(){
        MonkeyKingSubject subject = new MonkeyKingSubject();
        subject.addObserver(new ThunderGodObserver());
        subject.addObserver(new MyGuardianObserver());
        subject.addObserver(new DragonKingObserver());

        subject.doGoldenCudgel("up");
        System.out.println("我是分割线-----------------------------");
        subject.doGoldenCudgel("down");
    }

}
